#pragma once

#include <QtWidgets/QMainWindow>
#include <QString>
#include "ui_shoesGUI.h"
#include "QtMatchThread.h"

#include <vector>
#include <opencv2/opencv.hpp>

class shoesGUI : public QMainWindow
{
    Q_OBJECT

public:
    shoesGUI(QWidget *parent = nullptr);
    ~shoesGUI();

private:
    const int statusBarTimeout = 2000;
    Ui::shoesGUIClass ui;
    QString qsSrcPath;
    QString qsTemplatePath;
    QString qsSaveDir;

    cv::Mat src;
    cv::Mat srcImg;
    cv::Mat srcBinMat;
    
    cv::Mat templateImg;
    cv::Mat template_curve;
    cv::Mat outsideCurve;
    cv::Mat outsideCurveMask;
    int templateDilateSize = 3;

    cv::Mat resaultImg;
    cv::Scalar lowThreshold = cv::Scalar(30, 40, 105);
    cv::Scalar highThreshold = cv::Scalar(60, 110, 200);
    int constThreshold = 200;
    double scaleStep = 0.1;
    int rotateStep = 1;
    int downSampleScale = 2;
    int poolSize = 5;

    QtMatchThread* matchThread = NULL;
    
    float minScale;
    float maxScale;
    void srcPreprocess();
    void templatePreprocess();
    
private slots:
    void changeThreshold(int);
    void changeDownSampleScale(int);
    void GetMatchResault(cv::Mat* resaultMat);
    void GetMatchResault();
    void GetMatchStatus(int status_code, int param = 0);
    void updateResault();
};
